package Others.DesignPattern.SimpleFactoryPattern.Original;

import java.util.Scanner;

public class main {
    public static void main(String[] args) {
        try {
            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入第一个数字：");
            double num1 = scanner.nextDouble();
            System.out.println("请输入第二个数字：");
            double num2 = scanner.nextDouble();
            System.out.println("请输入运算符(+,-,*,/)：");
            String operation = scanner.next();
            double result = new Operation().getResult(num1, num2, operation);
            System.out.println("结果为：" + result);
        } catch (Exception e) {
            System.out.println("输入错误！" + e.getMessage());
        }

        //这里主要不好在--业务代码耦合在了一起--如果添加新的运算符，需要修改Operation代码--修改switch分支
        //而修改这些分支--对其他的业务逻辑就进行了干扰
    }
}
